<!DOCTYPE html>
<html>
<head>
    <title>我的消息</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/message.css"/>
    <link href="/css/likeHistory.css" rel="stylesheet" type="text/css">
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script>
        $(function () {

            //查询系统通知表的中的所有数据
            $.get('/users/systemNotification',function (data) {
                if (data.list.length === 0) {
                    $(".aui-scrollView").html("<div class=\"aui-center\">\n" +
                        "            <span class=\"aui-center-title\">没有系统消息~</span>\n" +
                        "        </div>");
                }
                console.log(data);
                $(".aui-scrollView").renderValues(data, {
                    getHref: function (item, value) {
                        var url = $(item).data("href");
                        $(item).attr("href", url + value);
                    },
                    doRead: function (item, value) {
                        //value是属性已读/未读
                        if (value == 1) {//未读
                            $(item).css("color", "Gold");//设置样式
                        }
                    }
                });

                //已读
                $.post("/users/updateType",{type:0},function (data) {

                })
            })
        })
    </script>
</head>
<body>
<section class="aui-flexView">
    <header class="aui-navBar aui-navBar-fixed b-line">
        <a href="/mine/message.html" class="aui-navBar-item">
            <i class="icon icon-return"></i>
        </a>
        <div class="aui-center">
            <span class="aui-center-title">我的系统消息</span>
        </div>
        <a href="javascript:;" class="aui-navBar-item">
        </a>
    </header>

    <section class="aui-scrollView">
        <div class="aui-list-box" render-loop="list">
            <div class="aui-flex">
                <div class="aui-flex-logo">
                    <img render-src="list.user.headImgUrl">
                </div>
                <div class="aui-flex-box">
                    <h2>
                        <span style="font-size: 12px" render-html="list.stateName"></span>
                    </h2>
                    <h3 render-html="list.travel.title" render-key="list.reading" render-fun="doRead"
                        render-attr="data-id=list.id" class="notices">
                    </h3>
                    <a render-key="list.travel.id" render-fun="getHref" data-href="/travelContent.html?id=">
                        点击查看
                    </a>
                </div>
                <span class="aui-flex-add" render-html="list.createTime"></span>
            </div>
        </div>
    </section>
</section>
</body>
</html>